Repository Public
1import { OpError, regenerateShot } from "@/lib/studio-ops";2import { isUuid, out, studio } from "@/lib/studio-api";34/** POST /api/studio/shots/:id/regenerate — { what: "image" | "video" | "voice", approve?: boolean }. Capped by the policy. */5export async function POST(req: Request, ctx: { params: Promise<{ id: string }> }) {6 const { id } = await ctx.params;7 return studio(req, "editor", async (user, body) => {8 const what = body.what;9 if (!isUuid(id)) throw new OpError("Shot not found", 404);10 if (what !== "image" && what !== "video" && what !== "voice") throw new OpError('"what" must be image, video or voice');11 const r = await regenerateShot(user, id, what, { approve: body.approve === true });12 return out({ shotId: id, stage: r.stage, jobId: r.runId, duplicate: r.duplicate }, 202);13 });14}15